<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewGenBankTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <script type="text/javascript">

                function handleComplete(xhr, status, args) {
                    {

                        if(!args.validationFailed || args.saved)
                        {
                            display.hide();
                        }
                        else
                        {
                            jQuery(display).effect("shake", { times:3 }, 100);
                        }
                    }
                }

                function displayFeature(id)
                {
                    alert(id);
                }


            </script>


            <h:form id="gen_form">
                <p:fieldset  legend="GenBank Details" id="gen_view" styleClass="form" >
                        <div class="icon_left">
                            <h:commandLink  action="/genBank/List" styleClass="menu_item" >
                                <h:graphicImage  value="../resources/images/syscon/genbank.png"   />
                                <br/>
                                <h:outputText  value="GenBanks"/>
                            </h:commandLink>
                        </div>
                        <h:outputText value="#{genBankController.current.definition}" styleClass="engraved"/>
                        <br/>
                        <h:outputText value="#{bundle.ViewGenBankLabel_idGen}" styleClass="label"/>
                        <h:outputText value="#{genBankController.current.idGen}" title="#{bundle.ViewGenBankTitle_idGen}"/>
                        <p:spacer width="10"/>
                        <h:outputText value="#{bundle.ViewGenBankLabel_version}" styleClass="label"/>
                        <h:outputText value="#{genBankController.current.version}"/>
                        <p:spacer width="10"/>
                        <h:outputText value="#{bundle.ViewGenBankLabel_definition}" styleClass="label"/>
                        <h:outputText value="#{genBankController.current.definition}" title="#{bundle.ViewGenBankTitle_definition}"/>
                        <p:spacer width="10"/>
                        <h:outputText value="#{bundle.ViewGenBankLabel_creationDate}" styleClass="label"/>
                        <h:outputText value="#{genBankController.current.creationDate}" title="#{bundle.ViewGenBankTitle_creationDate}">
                        </h:outputText>
                        <p:spacer width="10"/>
                        <h:outputText value="#{bundle.ViewGenBankLabel_createdBy}" styleClass="label"/>
                        <h:outputText value="#{genBankController.current.createdBy.userLogin}" title="#{bundle.ViewGenBankTitle_createdBy}"/>
                        <p:spacer width="10"/>
                        <h:outputText value="Project: " styleClass="label"/>
                        <h:outputText value="#{genBankController.current.prjFk.prjName}" title="#{bundle.ViewGenBankTitle_prjFk}"/>
                        <p:spacer width="10"/>
                        <br />
                        <p:separator/>
                        <c:if test="#{userController.allowedGroups('2')}">
                            <p:commandButton onclick="window.open('GenBankGraphic.bio','Viewer','scrollbars=yes,target=_blank')" value="Analyze"/>
                            <p:spacer width="5" />
                            <p:commandButton id="edit_com" ajax="false" action="Edit" value="#{bundle.ViewGenBankEditLink}" />
                            <p:spacer width="5" />
                            <p:commandButton id="new_com"  ajax="false" action="#{genBankController.prepareCreate}" value="New"/>
                            <p:spacer width="5" />
                            <p:commandButton id="list_com"  ajax="false" action="#{genBankController.prepareList}" value="Show All"/>
                            <p:spacer width="5" />
                            <p:commandButton id="rem_com"  ajax="false"  action="#{genBankController.destroy}" value="Delete"/>
                            <p:spacer width="5" />
                            <p:blockUI block=":gen_form:" trigger="edit_com,new_com,list_com,rem_com">
                                <h:outputText value="Please wait, data is being processed..." />  <br/>
                                <p:graphicImage value="/resources/ajaxloader.gif"/>
                            </p:blockUI>
                        </c:if>

                        <br />
                        <h:commandLink />
                        <br />
                        <p:pieChart   value="#{genBankController.pieModel}" legendPosition="w" diameter="150"  showDataLabels="true"  seriesColors="cfdbce,ff5c5c,ddf291,f2c56a,607df0"
                                      title="Relative Contig" style="width:500px;height:250px;">
                        </p:pieChart>
                        <h:outputText value=""/>
                        <p:dataTable
                            styleClass="form"
                            var="r"
                            rowKey="#{r}"
                            value="#{genBankController.pieModel.data.keySet().toArray()}"
                            >
                            <f:facet name="header">
                                <h:outputText value="Summary"/>
                            </f:facet>
                            <p:column sortBy="#{r}" filterBy="#{r}" filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="Name"/>
                                </f:facet>
                                <h:outputText value="#{r}"/>
                            </p:column>
                            <p:column sortBy="#{r}" filterBy="#{r}" filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="Name"/>
                                </f:facet>
                                <h:outputText value="#{genBankController.pieModel.data.get(r)}"/>
                            </p:column>
                        </p:dataTable >
                        <br />
                        <h:panelGrid columns="1" style="margin-bottom:10px">
                            <h:panelGroup>
                                <h:outputText value="Annotations Concluded %"/>
                                <h:outputText id="output" value="#{(genBankController.current_feat.featureKeyList.size() - genBankController.pieModel.data.get('Unverified'))/100}"/>
                            </h:panelGroup>

                            <h:inputHidden id="txt2" value="0" />
                            <p:slider for="txt2" display="output" style="width:200px" />
                        </h:panelGrid>
                        <p:fieldset  legend="Header" rendered="${not empty genBankController.current.featureList}" styleClass="form" toggleable="true" collapsed="true">
                            <p:dataTable id="feat_list"
                                         styleClass="data"
                                         var="feat"
                                         rowKey="#{feat}"
                                         value="#{genBankController.current.featureList}"
                                         selectionMode="single"
                                         paginator="#{genBankController.current.featureList.size() gt 18}"
                                         >
                                <p:ajax id="selection" event="rowSelect" listener="#{genBankController.onProfileSelect}" />
                                <f:facet name="header">
                                    <h:outputText value="Features"></h:outputText>
                                </f:facet>
                                <p:column sortBy="#{feat.name}" filterBy="#{feat.name}" filterMatchMode="contains">
                                    <f:facet name="header">
                                        <h:outputText value="Name"/>
                                    </f:facet>
                                    <h:outputText value="#{feat.name}"/>
                                </p:column>
                                <p:column sortBy="#{feat.value}" filterBy="#{feat.value}" filterMatchMode="contains">
                                    <f:facet name="header">
                                        <h:outputText value="Value"/>
                                    </f:facet>
                                    <h:outputText value="#{feat.value}"/>
                                </p:column>

                            </p:dataTable>

                            <p:contextMenu for="featkey_list" >
                                <p:menuitem id="edit_ann" ajax="false" action="/annotation/Edit" value="#{bundle.ViewGenBankEditLink}" />
                            </p:contextMenu>
                            <p:blockUI block=":gen_form:" trigger="show_fks">
                                <h:outputText value="Please wait, data is being processed..." />  <br/>
                                <p:graphicImage value="/resources/ajaxloader.gif"/>
                            </p:blockUI>
                        </p:fieldset>
                        <p:fieldset  legend="Feature Keys" rendered="${not empty genBankController.current_feat.featureKeyList}" styleClass="form" toggleable="true" collapsed="true">
                            <p:commandButton id="show_fks" action="#{genBankController.loadFeatures}" rendered="#{not genBankController.show_detail}" value="Show Feature Keys" update=":gen_form:">
                            </p:commandButton>
                            <p:commandButton  action="#{genBankController.flip()}" rendered="#{genBankController.show_detail}" value="Hide Feature Keys" update=":gen_form:"/>
                            <p:dataTable id="featkey_list"
                                         styleClass="data"
                                         rendered="#{genBankController.show_detail}"
                                         var="fk"
                                         rowKey="#{fk}"
                                         value="#{genBankController.current_feat.featureKeyList}"
                                         selectionMode="single"
                                         selection="#{genBankController.current_fk}"
                                         paginator="true"
                                         rows="100"
                                         >
                                <f:facet name="header">
                                    <h:outputText value="Features Key #{genBankController.current_feat.featureKeyList.size()}"></h:outputText>
                                </f:facet>
                                <p:column sortBy="#{fk.name}" filterBy="#{fk.name}" filterMatchMode="contains" id="fk">
                                    <f:facet name="header">
                                        <h:outputText value="Name"/>
                                    </f:facet>
                                    <h:outputText value="#{fk.name}"/>
                                </p:column>
                                <p:column sortBy="#{fk.value}" filterBy="#{fk.value}" filterMatchMode="contains">
                                    <f:facet name="header">
                                        <h:outputText value="Value"/>
                                    </f:facet>
                                    <h:outputText value="#{fk.value}"/>
                                </p:column>
                                <p:column sortBy="#{fk.statusStsId.stsStatus}" filterBy="#{fk.statusStsId.stsStatus}"  style="background-color:##{fk.statusStsId.stsColor}">
                                    <f:facet name="header">
                                        <h:outputText value="Status"/>
                                    </f:facet>
                                    <h:outputText value="#{fk.statusStsId.stsStatus}"/>
                                </p:column>
                            </p:dataTable>
                    </p:fieldset>
                </p:fieldset>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
